import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import java.util.Map;

/**
 * Created by lkkjzx on 2017/4/25.
 */
public class MysqlPipeline implements Pipeline {
    @Override
    public void process(ResultItems resultItems, Task task) {

        System.out.println(resultItems.getRequest().getUrl());
        for (Map.Entry<String, Object> entry : resultItems.getAll().entrySet()) {
            if (entry.getValue() instanceof Iterable) {
                System.out.println(entry.getKey() + ":\t" + entry.getValue());
//                Iterable value = (Iterable) entry.getValue();
//                for (Object o : value){
//                    System.out.println(value);
//                }
            } else {
                System.out.println(entry.getKey() + ":\t" + entry.getValue());
            }
        }
    }
}
